#ifndef _OPENGLAPPFRAMEWORK_PLUGIN_LODPLUGIN_H_
#define _OPENGLAPPFRAMEWORK_PLUGIN_LODPLUGIN_H_

#include "OpenglAppFramework/inc/OpenglEnv.h"
#include "OpenglAppFramework/inc/PlugIn/PlugIn.h"
#include <utility>

// "lod_group": [
//     {"distance": 10, "items": {"mesh": "ball_mesh_0", "material": "ball_material_0"}},
// ]

using LODItemGroup = std::map<PlugInType, std::pair<std::string, PlugIn*>>;
using LODItemGroups = std::vector<LODItemGroup>;

class Camera;
class LODPlugIn : public PlugIn {
public:
    LODPlugIn(const std::string& name);
    ~LODPlugIn();

    int setConfigData(const nlohmann::json& data) override;
    int init() override;
    void destroy() override;
    void routine() override;

private:
    std::string m_cam_name;
    GameObject* m_main_cam;
    LODItemGroups m_lod_groups;
    uint32_t m_cur_lod_level;
    std::vector<float> m_dist_list;
};

#endif//_OPENGLAPPFRAMEWORK_PLUGIN_LODPLUGIN_H_
